//
//  GestureMenuViewController.m
//  iOS UI Sample Code
//
//  Created by 규성 이 on 12. 3. 2..
//  Copyright (c) 2012년 kkamci77@gmail.com. All rights reserved.
//

#import "GestureMenuViewController.h"

@implementation GestureMenuViewController
@synthesize tvMainTable, aListData;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self.tvMainTable setDelegate:self];
    [self.tvMainTable setDataSource:self];
    self.aListData = [[NSMutableArray alloc] initWithObjects:@"TapGesture", nil];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void)dealloc {
    [tvMainTable release];
    [aListData release];
    [super dealloc];
}

#pragma mark - Table view data source Delegate Implements
// Require Method
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // #warning Incomplete method implementation.
    // Return the number of rows in the section.
    return [self.aListData count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
//    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"memolistCell"];
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        //cell = [[[NSBundle mainBundle] loadNibNamed:@"memolistCell" owner:self options:nil] lastObject];
    }
    
//    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    // Configure the cell...
    cell.textLabel.text = [self.aListData objectAtIndex:indexPath.row];
//    UILabel * label = (UILabel *)[cell viewWithTag:2];
//    [label setText:((MemoData *)[self.listData objectAtIndex:[indexPath row]]).name];
//    
//    UIImageView * imView = (UIImageView *)[cell viewWithTag:1];
//    [imView setImage:[((MemoData *)[self.listData objectAtIndex:[indexPath row]]) getThumbnailImage]];
//    
//    UILabel * lblDate = (UILabel *)[cell viewWithTag:3];
//    [lblDate setText:[((MemoData *)[self.listData objectAtIndex:[indexPath row]]).createDate description]];
    return cell;
}

// Optional Method
/*
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // #warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 1; // [self.sectionData count];
}
*/
/**
 * - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
 * 이 Method를 구현하면 자동으로 Swife하여 Delete 버튼이 표시되게 된다.
 */
/*
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(editingStyle == UITableViewCellEditingStyleDelete)
    {
        NSLog(@"Delete EditStyle = %d", editingStyle);
    }
    else if(editingStyle == UITableViewCellEditingStyleInsert)
    {
        NSLog(@"Edit Style is Insert");
    }else
    {
        NSLog(@"Edit Style is None");
    }
}
*/
/*
 // Override to support conditional editing of the table view.
 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
 {
 // Return NO if you do not want the specified item to be editable.
 return YES;
 }
*/

@end
